<?php
$directory = "data/";

if (isset($_POST['action'])&&!empty($_POST['action']))
{
  $action = $_POST['action'];
  if (strcmp($action, "states.txt")==0)
  {
    $contents = file_get_contents($directory.$action);
    echo $contents;
  }
}
else
{
  echo "error";
}
?>